package servlets;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import domainObjects.Dossier;
import beans.DossierBean;
import beans.InfractionBean;

/**
 * Servlet implementation class SelectionDossier
 */
public class SelectionDossier extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SelectionDossier() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		long id = Long.parseLong(request.getParameter("ID"));
		DossierBean dossierBean = new DossierBean();
		InfractionBean infractionBean = new InfractionBean();
		try {
			Dossier dossier = dossierBean.findDossier(id);
			request.getSession().setAttribute("CurrentDossier", dossier);
		} catch (SQLException e) {
		}	
		response.sendRedirect("/equipe6-log720-A11-lab2/VisualiserDossier");
	}

}
